<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/babel.min.js"></script>
</head>
<body>
    <div id="test"></div>
    <script type="text/babel">
        class Dog extends React.Component{
            /* 
                1、类式组件中的构造器完全可以省略
                2、若写了构造器，super必须调用,且需要在构造器中通过this.props取值，那么super中必须传props
            */ 
           state={}
            constructor(props){
                console.log('##',props);
                // super()
                // console.log(this.props);
            }
            render(){
                const {name,age} = this.props;
                return <h2>狗狗的名字叫{name},今年{age}岁了</h2>
            }
        }
        ReactDOM.render(<Dog name='柯基' age={4}/>,document.getElementById('test'))
    </script>
</body>
</html>